Image processing apparatus, electronic device, image processing method, and storage medium storing image processing program

ABSTRACT

An image processing apparatus that performs image registration processing between a plurality of images through a motion vector calculation sets a plurality of motion vector measurement regions on an image, calculates a motion vector in each of the plurality of motion vector measurement regions, specifies a region of interest on the image, determines whether or not each of the plurality of motion vector measurement regions is included in the region of interest, calculates a contribution of each motion vector such that the contribution of the motion vector of a motion vector measurement region included in the region of interest is larger than the contribution of the motion vector of a motion vector measurement region not included in the region of interest, and determines an inter-image motion vector by integrating the motion vectors calculated respectively in the plurality of motion vector measurement regions in accordance with the calculated contribution.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Patent Application No. PCT/JP2009/059485, filed on May 19, 2009, which claims the benefit of Japanese Patent Application No. JP 2008-140905, filed on May 29, 2008, which is incorporated by reference as if fully set forth.

FIELD OF THE INVENTION

This invention relates to a technique for performing registration processing between a plurality of images using a motion vector calculation.

BACKGROUND OF THE INVENTION

A correlation method and a block matching method based on a correlation calculation are known as conventional methods of detecting motion vectors between a plurality of images. The block matching method is a method of dividing an input image signal into a plurality of blocks of an appropriate size (8 pixels×8 lines, for example), calculating differences with pixels in a fixed range of a previous frame in units of these blocks, and searching for a block having a smallest sum of absolute values of the differences. A relative deviation between the images represents a motion vector of the corresponding block. The motion vectors of the respective blocks are then integrated, whereupon an inter-frame representative motion vector is calculated and used to perform final image registration.

A method of determining a sum of squared intensity difference (SSD), which is a sum of squares of a difference between pixel values, and a method of determining a sum of absolute intensity difference (SAD), which is a sum of absolute values of a difference between pixel values, are known as methods of searching for a block having a high correlation during block matching. In these methods, the correlation (degree of coincidence) is determined to be steadily higher as the SSD or SAD decreases. In a matching reference block region I and a subject block region I′, when pixel values of pixel positions p ∈ I and q ∈ I′ (where p, q are quantities having two-dimensional values, I, I′ are two-dimensional regions, and p ∈ I indicates that a coordinate p is included in the region I) are set as Lp, Lq, respectively, SSD and SAD are respectively expressed by following Equations (1) and (2).

$\begin{matrix} {{{SSD}\left( {I,I^{\prime}} \right)} = {\sum\limits_{{p \in I},\mspace{14mu} {q \in I^{\prime}}}\left( {{Lp} - {Lq}} \right)^{2}}} & (1) \\ {{{SAD}\left( {I,I^{\prime}} \right)} = {\sum\limits_{{p \in I},\mspace{14mu} {q \in I^{\prime}}}{{{Lp} - {Lq}}}}} & (2) \end{matrix}$

Further, a method employing a normalized cross-correlation (NCC) also exists. As a zero average correlation, average values Ave (Lp), Ave (Lq) of the pixels p ∈ I and q ∈ I′ respectively included in the matching reference block region I and the subject block region I′ are calculated, whereupon differences with pixel values included in the respective blocks are calculated using following Equations (3) and (4).

$\begin{matrix} {{Lp}^{\prime} = {\quad\frac{{Lp} - {{Ave}({Lp})}}{\sqrt{\frac{1}{n}{\sum\limits_{p \in I}\left( {{Lp} - {{Ave}({Lp})}} \right)^{2}}}}}_{p \in I}} & (3) \\ {{Lq}^{\prime} = {\quad\frac{{Lq} - {{Ave}({Lq})}}{\sqrt{\frac{1}{n}{\sum\limits_{q \in I^{\prime}}\left( {{Lq} - {{Ave}({Lq})}} \right)^{2}}}}}_{q \in I^{\prime}}} & (4) \end{matrix}$

Next, the normalized cross-correlation NCC is calculated using a following Equation (5).

NCC=ΣLp′Lq′  (5)

A block having a large normalized cross-correlation NCC is determined to be a block having a high degree of coincidence (a high correlation), whereupon a relative deviation between the blocks I′ and I having the highest degree of coincidence is determined and set as the motion vector.

When a motion vector is calculated in relation to an object that may be considered to be a stationary plain surface or may be in the infinite distance and substantially no effect is received from optical system distortion, the motion vectors of the individual regions match an overall motion vector of the image. However, when an image is obtained using an optical system that exhibits large distortion over a wide field angle, an amount of distortion varies greatly according to an image height, and therefore the motion vector of the image varies greatly according to the image height even when an object that may be considered to be a plain surface or may be in the infinite distance moves horizontally. For example, when an image is obtained using an optical system exhibiting negative distortion (barrel-shaped distortion), as in the case shown in FIG. 9, an image formed on an image periphery is smaller than an image formed in an image center, as shown in FIG. 10. It should be noted that the image height is a distance from an optical axis on an image surface.

As a result, it becomes difficult to perform image registration at a central portion and a peripheral portion of an image simultaneously when performing registration of a plurality of images, for example. To solve this problem, a technique of detecting a motion vector using an image in relation to which the optical system distortion has already been corrected is known (JP2007-129587A).

SUMMARY OF THE INVENTION

An image processing apparatus of an aspect of the present invention for performing image registration processing between a plurality of images through a motion vector calculation comprises a motion vector measurement region setting unit that sets a plurality of motion vector measurement regions for determining motion vectors on an image, a motion vector calculation unit that calculates a motion vector in each of the plurality of motion vector measurement regions, a region specification unit that specifies a region of interest by user interest on the image, a positional relationship determination unit that determines whether or not each of the plurality of motion vector measurement regions is included in the region of interest, a contribution calculation unit that calculates a contribution of each motion vector such that the contribution of the motion vector of a motion vector measurement region included in the region of interest is larger than the contribution of the motion vector of a motion vector measurement region not included in the region of interest, and a motion vector integration unit that determines an inter-image motion vector by integrating the motion vectors calculated respectively in the plurality of motion vector measurement regions in accordance with the calculated contribution.

A storage medium of another aspect of the present invention stores an image processing program for causing a computer to execute registration processing between a plurality of images through a motion vector calculation. The image processing program comprises the steps of setting a plurality of motion vector measurement regions for determining motion vectors on an image, calculating a motion vector in each of the plurality of motion vector measurement regions, specifying a region of interest by user interest on the image, determining whether or not each of the plurality of motion vector measurement regions is included in the region of interest, calculating a contribution of each motion vector such that the contribution of the motion vector of a motion vector measurement region included in the region of interest is larger than the contribution of the motion vector of a motion vector measurement region not included in the region of interest, and determining an inter-image motion vector by integrating the motion vectors calculated respectively in the plurality of motion vector measurement regions in accordance with the calculated contribution.

An image processing method of yet another aspect of the present invention for performing image registration processing between a plurality of images through a motion vector calculation comprises the steps of setting a plurality of motion vector measurement regions for determining motion vectors on an image, calculating a motion vector in each of the plurality of motion vector measurement regions, specifying a region of interest by user interest on the image, determining whether or not each of the plurality of motion vector measurement regions is included in the region of interest, calculating a contribution of each motion vector such that the contribution of the motion vector of a motion vector measurement region included in the region of interest is larger than the contribution of the motion vector of a motion vector measurement region not included in the region of interest, and determining an inter-image motion vector by integrating the motion vectors calculated respectively in the plurality of motion vector measurement regions in accordance with the calculated contribution.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing the constitution of an image processing apparatus according to an embodiment.

FIG. 2 is a view showing an example of blocks set on a reference frame.

FIG. 3 is a view showing the constitution of a motion vector integration processing unit in detail.

FIG. 4 is a view showing an example of a characteristic amount evaluation region.

FIG. 5A shows a state in which a hollow pipe-shaped object is observed with an endoscope.

FIG. 5B shows a state in which an object that is close to a part of a spherical surface is observed with the endoscope.

FIG. 6A is a view showing brightness on the image corresponding to an observation state shown in FIG. 5A.

FIG. 6B is a view showing brightness on the image corresponding to an observation state shown in FIG. 5B.

FIG. 7 is a flowchart showing a processing procedure of the processing performed by the image processing apparatus according to the embodiment.

FIG. 8 is a view showing an example of setting five characteristic amount evaluation regions.

FIG. 9 is a view showing an example of an optical system exhibiting negative distortion.

FIG. 10 is a view showing that an image formed on an image periphery is smaller than an image formed in an image center when an image is obtained using the optical system exhibiting negative distortion.

FIG. 11 is a view for explanation of problem of conventional technology.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

FIG. 1 is a block diagram showing the constitution of an image processing apparatus according to an embodiment. In the figure, dotted lines denote control signals, thin lines denote the flow of data such as motion vectors and reliability values, and thick lines denote the flow of image data. The image processing apparatus according to this embodiment is installed in an electronic device that depends on a current or an electromagnetic field to operate correctly, such as a digital camera, a digital video camera, or an endoscope.

A main controller 102 is a processor that performs overall operation control on the apparatus, and employs a CPU such as a DSP (Digital Signal Processor), for example.

A plurality of images photographed at different times using an image pickup device or an external device not shown in the figures, for example, are input into an image input unit 101. The images of the plurality of frames input into the image input unit 101 are temporarily stored in a frame memory 107. Data for the plurality of frames stored in the frame memory 107 include data of a reference frame serving as a registration reference and data of a subject frame to be registered relative to the reference frame.

A motion vector measurement block setting unit 103 (to be referred to hereafter as a block setting unit 103) sets a predetermined plurality of motion vector measurement blocks on the reference frame stored in the frame memory 107. The motion vector measurement blocks are used when the reference frame and the subject frame are registered. Hereafter, the motion vector measurement blocks will be referred to simply as “blocks”.

FIG. 2 is a view showing an example of a plurality of blocks 20 set on the reference frame. In the example shown in FIG. 2, the blocks 20 are set on the reference frame in a lattice shape. Central coordinates of each block 20 serve as a start point of the motion vector.

A motion vector calculation unit 104 uses the image data of the reference frame and the subject frame stored in the frame memory 107 and data relating to the blocks set by the block setting unit 103 to calculate a block position of the subject frame having a high correlation with a block of the reference frame through block matching, in which a coincidence index value such as the aforementioned SSD, SAD, or NCC is calculated. This processing is executed on all of the blocks.

Central coordinates of the highly correlated block in the subject frame serve as an end point of the motion vector. Accordingly, a vector extending from the central coordinates of a block in the reference frame to the central coordinates of the highly correlated block in the subject frame serves as the motion vector. It should be noted that reference position coordinates are matched such that lower left edge positions of the reference frame and subject frame are set as origins, for example.

A motion vector reliability calculation unit 105 calculates a reliability value indicating the reliability of the motion vector determined by the motion vector calculation unit 104. The reliability may be any value that indicates the reliability of the calculated motion vector. For example, the reliability may be determined using a known method such as setting the reliability in accordance with a number of horizontal direction and vertical direction edges in the block or using the coincidence index value such as the SSD, SAD, or NCC itself.

A characteristic amount evaluation region setting unit 108 sets a plurality of characteristic amount evaluation regions by dividing the reference frame in the frame memory 107 into a plurality of regions. The characteristic amount evaluation regions will be described in detail below.

A characteristic amount calculation unit 109 calculates one or a plurality of characteristic amounts in relation to the characteristic amount evaluation regions set by the characteristic amount evaluation region setting unit 108. The characteristic amount is a parameter used to specify a region of interest, which is a region of the image in which a user has an interest, and will be described in detail below.

A motion vector integration processing unit 106 calculates a representative value of the motion vectors between the reference frame and the subject frame by integrating the data of a plurality of motion vectors using the characteristic amount information calculated by the characteristic amount calculation unit 109. A method of calculating the motion vector representative value will be described below.

A frame addition unit 110 performs frame addition processing on the basis of the image data of the reference frame and the subject frame stored in the frame memory 107 and correction vector data (the representative value of the inter-image motion vector) calculated by the motion vector integration processing unit 106.

It should be noted that the constitution shown in FIG. 1 is an example of frame addition, but moving image blur correction, in which the subject frame is registered relative to the reference frame using a correction vector, may be performed instead. In moving image blur correction, blur is decreased by correcting the subject frame relative to the reference frame using the correction vector.

FIG. 3 is a view showing the constitution of the motion vector integration processing unit 106 in detail. The motion vector integration processing unit 106 comprises a region determination unit 1061, a positional relationship determination unit 1062, a contribution calculation unit 1063, and an integration calculation processing unit 1064. It is assumed in the following description, for the purpose of simplification, that a single characteristic amount is used.

When m characteristic amount evaluation regions are set on the reference frame, the region determination unit 1061 specifies the region of interest in which the user has an interest using a total of m characteristic amounts Cj (j=1, . . . , m) calculated from the respective characteristic amount evaluation regions.

The positional relationship determination unit 1062 uses position information relating to the characteristic amount evaluation regions and position information relating to the blocks set by the block setting unit 103 to determine the characteristic amount evaluation region to which each motion vector belongs. The contribution calculation unit 1063 uses the positional relationship information determined by the positional relationship determination unit 1062 to calculate a contribution of each motion vector. The contribution is a value indicating a weight of each motion vector used when the plurality of motion vectors are integrated in order to calculate the inter-image motion vector representative value.

The integration calculation processing unit 1064 calculates the representative value of the motion vectors between the reference frame and the subject frame on the basis of the reliability of each motion vector calculated by the motion vector reliability calculation unit 105, the contribution of each motion vector calculated by the contribution calculation unit 1063, and the respective motion vectors calculated by the motion vector calculation unit 104.

Here, a case in which an average luminance of the characteristic amount evaluation region is used as the characteristic amount will be described. It is assumed in the following description, for the purpose of simplification, that two regions are set as characteristic amount evaluation regions, as shown in FIG. 4. On an image shown in FIG. 4, a central region in which a distance r from an image center (x0, y0) is 0≦r≦r0 is set as a characteristic amount evaluation region A1 (or simply, a region A1), and a peripheral region in which r0<r is set as a characteristic amount evaluation region A2 (or simply, a region A2). Further, the average luminance of the regions A1, A2 is L1, L2, respectively.

FIGS. 5A and 5B are views showing two representative observation states occurring when the user observes an organism using an endoscope. FIG. 5A shows a state in which a hollow pipe-shaped object 52 (a pipe shape having an internal cavity) is observed through an image pickup unit 51 of the endoscope, and FIG. 5B shows a state in which an object 53 that is close to a part of a spherical surface is observed. Dotted lines in the figures indicate an angle of visibility of the image pickup unit. Further, a range that substantially overlaps the angle of visibility is illuminated by an illumination unit (not shown) provided in the vicinity of the image pickup unit 51.

As shown in FIG. 5A, when the hollow pipe-shaped object 52 is observed, an object positioned near the center of the image is much further from the image pickup unit 51 than an object positioned on a peripheral portion of the image. As the distance from the image pickup unit 51 increases, it becomes more and more difficult for light from the illumination unit (not shown) to reach the object, and therefore, when the entire image is viewed, as shown in FIG. 6A, the region A2 on the peripheral portion of the image is brighter than the region A1 in the central portion.

In this case, the region in which the user has an interest is an internal wall surface of the hollow pipe-shaped object 52, and on an image surface shown in FIG. 6A, the region of interest is positioned in the characteristic amount evaluation region A2. The region determination unit 1061 compares the average luminance L1 of the region A1 with the average luminance L2 of the region A2 and determines that the region A2 having a larger luminance is the region of interest. Hence, as will be described below, the inter-frame motion vector representative value is calculated by increasing the contribution of the motion vectors included in the region A2, from among the motion vectors of the respective blocks, and in so doing, the region of interest can be registered reliably.

Next, a case in which the object 53 that is close to a part of a spherical surface is observed, as shown in FIG. 5B, will be considered. In this case, the distance from the image pickup unit 51 to the object does not vary greatly between the central portion and the peripheral portion of the image. In this state, an image in which the region A1 in the central portion of the image is brighter than the region A2 in the peripheral portion, as shown in FIG. 6B, is typically obtained due to the effects of a light distribution of the illumination, vignetting of the optical system, and so on.

In this case, the user operates the endoscope such that the region of interest enters the region A1 positioned in the center of the image in order to observe the region of interest within a bright image including little distortion. The region determination unit 1061 compares the average luminance L1 of the region A1 to the average luminance L2 of the region A2 and determines that the region A1 having greater luminance is the region of interest. Next, as will be described below, the inter-frame motion vector representative value is calculated by increasing the contribution of the motion vectors included in the region A1, from among the motion vectors of the respective blocks, and in so doing, the region of interest can be registered reliably.

The positional relationship determination unit 1062 determines whether central coordinates (bxi, byi) of an i^(th) block are included in the region A1 or the region A2. Here, assuming that the central coordinates of the image are (x0, y0), the central coordinates (bxi, byi) of the i^(th) block are determined to be included in the region A2 when a relationship of a following Equation (6) is established and determined to be included in the region A1 when the relationship of Equation (6) is not established.

{square root over (√(bxi−x0)²+(byi−y0)²)}{square root over (√(bxi−x0)²+(byi−y0)²)}>r0   (6)

The contribution calculation unit 1063 sets the contribution of each motion vector such that the contribution of a motion vector of a block included in the region of interest is larger than the contribution of a motion vector of a block not included in the region of interest. When it is determined that the i^(th) block is included in the region of interest, a contribution Ki is set at 1, and when it is determined that the i^(th) block is not included in the region of interest, the contribution Ki is set at 0. For example, when the region determination unit 1061 determines that the region A1 is the region of interest and the i^(th) block is determined to be included in the region A1, the contribution Ki of the i^(th) block is set at 1, whereas when the i^(th) block is determined to be included in the region A2, the contribution Ki is set at 0.

The integration calculation processing unit 1064 first compares the reliability Si of each motion vector, calculated by the motion vector reliability calculation unit 105, with a predetermined threshold S_Thr, and calculates a threshold-processed reliability STi on the basis of the comparison result. More specifically, when the reliability Si is equal to or smaller than the predetermined threshold S_Thr, STi=0 is set, and when the reliability Si is larger than the predetermined threshold S_Thr, STi=Si is set.

Next, the integration calculation processing unit 1064 calculates a representative value V_(Frame) of the motion vectors between the reference frame and the subject frame using the threshold-processed reliability STi, the contribution Ki of each motion vector, and each motion vector Vi in accordance with a following Equation (7). It should be noted that a denominator on the right side is a normalization coefficient.

$\begin{matrix} {V_{Frame} = {\frac{1}{\sum{{STi}{\sum{Ki}}}}{\sum\left( {{STi} \cdot {Ki} \cdot {Vi}} \right)}}} & (7) \end{matrix}$

According to Equation (7), when the motion vectors of the respective blocks are integrated to calculate the representative value V_(Frame) of the motion vectors between the reference frame and the subject frame, the effect of motion vectors having a low reliability STi and motion vectors having a small contribution Ki is reduced. In particular, the contribution Ki of the motion vectors included in the region of interest is set at 1 and the contribution Ki of the motion vectors not included in the region of interest is set at 0, and therefore the inter-image motion vector representative value V_(Frame) can be calculated using only the motion vectors included in the region in which the user has an interest.

Further, when the reliability Si is equal to or lower than the predetermined threshold S_Thr, the threshold-processed reliability STi is set at 0, and therefore the effect of motion vectors having a low reliability Si can be eliminated, with the result that the motion vector representative value V_(Frame) can be calculated with a high degree of precision.

FIG. 7 is a flowchart showing a processing procedure of the processing performed by the image processing apparatus according to this embodiment. In a step S10, the block setting unit 103 sets a plurality of blocks on the reference frame stored in the frame memory 107.

In a step S20, the motion vector calculation unit 104 calculates the motion vector of each block. In a step S30, the motion vector reliability calculation unit 105 calculates the reliability Si of each of the motion vectors determined in the step S20.

In a step S40, the characteristic amount evaluation region setting unit 108 sets the characteristic amount evaluation regions on the reference frame. It is assumed hereafter that the two regions A1, A2 shown in FIG. 4 are set.

In a step S50, the characteristic amount calculation unit 109 calculates the characteristic amounts of the characteristic amount evaluation regions A1, A2 set in the step S40. It is assumed hereafter that the average luminance L1, L2 of the regions A1, A2 is calculated as the characteristic amount, as described above.

Processing from a step S60 to a step S170 is performed by the motion vector integration processing unit 106. In the step S60, the region determination unit 1061 determines whether or not the average luminance L2 of the region A2 is larger than the average luminance L1 of the region A1. When it is determined that the average luminance L2 is larger than the average luminance L1, the region A2 is determined to be the region of interest, whereupon the routine advances to a step S70.

In the step S70, the positional relationship determination unit 1062 determines whether or not the central coordinates (bxi, byi) of the i^(th) block are included in the region A2. As described above, this determination is made on the basis of whether or not the relationship of Equation (6) is established. When it is determined that the central coordinates (bxi, byi) of the i^(th) block are included in the region A2, the routine advances to a step S80, and when it is determined that the central coordinates (bxi, byi) are not included in the region A2, the routine advances to a step S90.

In the step S80, since the central coordinates (bxi, byi) of the i^(th) block are included in the region A2, which is the region of interest, the contribution calculation unit 1063 sets the contribution Ki of the motion vector of the i^(th) block at 1. In the step S90, on the other hand, since the central coordinates (bxi, byi) of the i^(th) block are not included in the region of interest A2, the contribution calculation unit 1063 sets the contribution Ki of the motion vector of the i^(th) block at 0.

When the determination of the step S60 is negative, the region A1 is determined to be the region of interest, whereupon the processing advances to a step S100. In the step S100, the positional relationship determination unit 1062 determines whether or not the central coordinates (bxi, byi) of the i^(th) block are included in the region A2. This determination is also made on the basis of whether or not the relationship of Equation (6) is established. When it is determined that the central coordinates (bxi, byi) of the i^(th) block are included in the region A2, the routine advances to a step S110, and when it is determined that the central coordinates (bxi, byi) are not included in the region A2, the routine advances to a step S120.

In the step S110, since the central coordinates (bxi, byi) of the i^(th) block are included in the region A2, which is not the region of interest, the contribution calculation unit 1063 sets the contribution Ki of the motion vector of the i^(th) block at 0. In the step S120, on the other hand, since the central coordinates (bxi, byi) of the i^(th) block are included in the region A1, which is the region of interest, the contribution calculation unit 1063 sets the contribution Ki of the motion vector of the i^(th) block at 1.

Processing from a step S130 to the step S170 is performed by the integration calculation processing unit 1064. In the step S130, a determination is made as to whether or not the reliability Si of the motion vector of the i^(th) block is higher than the predetermined threshold S_Thr. When the reliability Si is determined to be higher than the predetermined threshold S_Thr, the routine advances to a step S140, and when the reliability Si is determined to be equal to or lower than the predetermined threshold S_Thr, the routine advances to a step S150.

In the step S140, the reliability Si is set as the threshold-processed reliability STi. In the step S150, on the other hand, the threshold-processed reliability STi is set at 0.

In a step S160, a determination is made as to whether or not the processing for calculating the contribution Ki and the threshold-processed reliability STi has been performed on all of the blocks. When it is determined that the processing has not yet been performed on all of the blocks, the routine returns to the step S60, where the processing from the step S60 onward is performed on another block. When it is determined that the processing has been performed on all of the blocks, on the other hand, the routine advances to the step S170.

In the step S170, the representative value V_(Frame) of the motion vectors between the reference frame and the subject frame is calculated using Equation (7) shown above.

In a step S180, the frame addition unit 110 performs frame addition processing on the basis of the image data relating to the reference frame and the subject frame stored in the frame memory 107 and the motion vector representative value V_(Frame) calculated by the motion vector integration processing unit 106. In other words, the reference frame is shifted by the motion vector representative value V_(Frame) and then added to the subject frame.

In the above description, the average luminance L1, L2 of the characteristic amount evaluation regions A1, A2 is used as the characteristic amount, but a number of pixels constituting edges in the characteristic amount evaluation regions may be used instead. An example in which numbers E1, E2 obtained by normalizing the number of pixels constituting edges by pixel counts (surface areas) of the respective regions A1, A2 are used as the characteristic amount will be described below.

In the region in which the user has an interest, observation conditions such as the brightness and the focus of the optical system are favorable, and therefore the number of pixels constituting edges is large. Hence, the region determination unit 1061 compares the edge number E1 of the region A1 with the edge number E2 of the region A2, and then determines that the region A2 is the region of interest when a relationship of E2>E1 is established and that the region A1 is the region of interest when the relationship of E2>E1 is not established. Processing following determination of the regions of interest is identical to the processing described above.

In the description heretofore, the two regions A1, A2 shown in FIG. 4 were set as the characteristic amount evaluation regions for simplicity. However, an actual organism has a complicated, non-axial shape, and therefore, as shown in FIG. 8, for example, a larger number of characteristic amount evaluation regions may be set such that the region of interest is limited to a small region. In the example shown in FIG. 8, five characteristic amount evaluation regions A11 to A15 including a single central region A11 and four peripheral regions A12 to A15 positioned on the periphery of the central region A11 are set. As shown in FIG. 8, the region having the highest average luminance or the region having the largest number of pixels constituting edges may be determined as the region of interest likewise in a case where three or more characteristic amount evaluation regions are set. Hence, by reducing the size of a single characteristic amount evaluation region, the range of the region of interest can be reduced, and as a result, the region of interest can be registered even more reliably.

When the region of interest is determined using the average luminance as the characteristic amount, a case in which an excessively bright, saturated region is determined mistakenly as the region of interest, for example, may occur. Meanwhile, when the number of pixels constituting edges is used to determine the region of interest, a case in which noise increases in an extremely dark region such that the noise is counted mistakenly as an edge, leading to an increase in the number of pixels constituting edges and mistaken determination of the corresponding region as the region of interest, may occur. To prevent such cases in which a region is determined mistakenly to be the region of interest, the region of interest may be determined by combining a plurality of characteristic amounts, for example.

An example in which the average luminance of each region and the number of pixels constituting edges are used as characteristic amounts will be described below. When the region of interest is determined from a plurality of characteristic amount evaluation regions, as shown in FIG. 8, using the average luminance of each region and the number of pixels constituting edges, first, threshold processing is performed with respect to the average luminance of each region, for example. When, in the threshold processing, the average luminance of a certain region is equal to or larger than an arbitrary upper limit value Lmax and equal to or lower than an arbitrary lower limit value Lmin, for example, it is determined that this region is not the region of interest. The upper limit value Lmax is a threshold for eliminating an excessively bright region as the region of interest, and the lower limit value Lmin is a threshold for eliminating an excessively dark region as the region of interest.

Next, the region having the largest number of pixels constituting edges, from among the remaining regions, is determined to be the region of interest. When the central coordinates of the subject block are included in the region of interest, the contribution Ki is set at 1, and when the central coordinates are not included in the region of interest, the contribution Ki is set at 0.

It should be noted that a new characteristic amount other than the aforesaid average luminance and number of pixels constituting edges may be introduced. In this case, the newly introduced characteristic amount may be used alone or in combination with the average luminance of the region or the number of pixels constituting edges to determine the region of interest.

Here, a case in which an image obtained using a typical endoscope exhibiting large optical system distortion is registered will be considered. In an endoscope used to observe the interior of an organism, the object exists in a position close to the optical system and has a three-dimensional, rather than planar, structure. When an image subjected to distortion correction is used in relation to this type of object, as in the prior art, local variation occurs in an optical magnification due to differences in the distance from the optical system to the object, as shown in FIG. 11, leading to local variation in the motion vector. Further, since the object does not have a constant shape, it is extremely difficult to register the entire image precisely at the same time. Hence, with a conventional technique in which motion vectors are detected using an image in relation to which the distortion of the optical system has already been corrected, the region in which the user has an interest cannot be registered reliably.

With the image processing apparatus according to the embodiment described above, first, the plurality of blocks used to determine the motion vectors are set on the image, whereupon the motion vector of each set block is calculated and the region of interest by user interest is specified. The contribution of each motion vector is then calculated such that the contribution of the motion vectors of the blocks included in the region of interest is larger than the contribution of the motion vectors of the blocks not included in the region of interest, whereupon the inter-image motion vector is determined by integrating the plurality of motion vectors in accordance with the calculated contributions. By calculating the contribution of each block used when integrating the plurality of motion vectors such that the contribution of the motion vectors of the blocks included in the region of interest is larger than the contribution of the motion vectors of the blocks not included in the region of interest, the region in which the user has an interest can be registered reliably.

By setting a plurality of characteristic amount evaluation regions on the image, calculating the characteristic amount indicating the characteristic of each region, and specifying the region of interest from the respective regions on the basis of the calculated characteristic amount, the region in which the user has an interest can be specified with a particularly high degree of precision.

When the average luminance of each region is used as the characteristic amount, the region of interest can be specified with a high degree of precision using a characteristic according to which the luminance of the region in which the user has an interest is high. Further, when the number of pixels constituting edges in each region is calculated as the characteristic amount, the region of interest can be specified with a high degree of precision using a characteristic according to which the number of pixels constituting edges is large in the region in which the user has an interest. Moreover, when both the average luminance of each region and the number of pixels constituting edges are used as characteristic amounts, the region of interest can be specified with an even higher degree of precision than when the average luminance of each region or the number of pixels constituting edges is used alone.

Furthermore, by setting the contribution of the motion vectors of the blocks not included in the region of interest at zero, the inter-image motion vector can be calculated with a high degree of precision using only the motion vectors of the blocks included in the region of interest. As a result, the region in which the user has an interest can be registered reliably.

With the image processing apparatus according to this embodiment, a reliability value indicating the reliability of each motion vector is calculated, and the inter-image motion vector is determined by integrating the plurality of motion vectors in accordance with the contribution and reliability of each motion vector. Therefore, the inter-image motion vector can be determined with an even higher degree of precision.

It should be noted that in the embodiment described above, it is assumed that the processing performed by the image processing apparatus is hardware processing. However, this invention need not be limited to this constitution, and the processing may be performed using software, for example. In this case, the image processing apparatus includes a CPU, a main storage device such as a RAM, and a computer-readable storage medium storing a program for realizing all or a part of the processing described above. Here, this program will be referred to as an image processing program. By having the CPU read the image processing program stored on the storage medium so as to execute information processing/calculation processing, similar processing to that of the image processing apparatus described above is realized.

Here, the computer-readable storage medium is a magnetic disk, a magneto-optical disk, a CD-ROM, a DVD-ROM, a semiconductor memory, or similar. Alternatively, the image processing program may be distributed to a computer via a communication line such that the computer, having received the distributed program, executes the image processing program.

This invention is not limited to the embodiments described above, and may be subjected to various modifications and applications within a scope that does not depart from the technical spirit thereof. For example, a rectangular block is cited as an example of the regions set by the block setting unit 103 in order to determine the motion vectors, but the regions are not limited to rectangular blocks. The regions set by the block setting unit 103 may be referred to as motion vector measurement regions. 

1. An image processing apparatus that performs image registration processing between a plurality of images through a motion vector calculation, comprising: a motion vector measurement region setting unit that sets a plurality of motion vector measurement regions for determining motion vectors on an image; a motion vector calculation unit that calculates a motion vector in each of the plurality of motion vector measurement regions; a region specification unit that specifies a region of interest by user interest on the image; a positional relationship determination unit that determines whether or not each of the plurality of motion vector measurement regions is included in the region of interest; a contribution calculation unit that calculates a contribution of each motion vector such that the contribution of the motion vector of a motion vector measurement region included in the region of interest is larger than the contribution of the motion vector of a motion vector measurement region not included in the region of interest; and a motion vector integration unit that determines an inter-image motion vector by integrating the motion vectors calculated respectively in the plurality of motion vector measurement regions in accordance with the calculated contribution.
 2. The image processing apparatus as defined in claim 1, further comprising: a region division unit that divides the image into a plurality of regions; and a characteristic amount calculation unit that calculates a characteristic amount indicating a characteristic of each of the plurality of divided regions, wherein the region specification unit specifies the region of interest from among the plurality of divided regions on the basis of the calculated characteristic amount.
 3. The image processing apparatus as defined in claim 2, wherein the characteristic amount calculation unit calculates an average luminance of each of the plurality of divided regions as the characteristic amount.
 4. The image processing apparatus as defined in claim 3, wherein the region specification unit specifies a region having a highest average luminance of the average luminance calculated for each of the plurality of divided regions as the region of interest.
 5. The image processing apparatus as defined in claim 2, wherein the characteristic amount calculation unit calculates a number of pixels constituting edges included in each region as the characteristic amount.
 6. The image processing apparatus as defined in claim 5, wherein the region specification unit specifies a region having a largest number of pixels constituting edges as the region of interest.
 7. The image processing apparatus as defined in claim 2, wherein the characteristic amount calculation unit calculates an average luminance of each of the plurality of divided regions and a number of pixels constituting edges included in each region as the characteristic amount.
 8. The image processing apparatus as defined in claim 7, wherein the region specification unit specifies a region having a largest number of pixels constituting edges from among regions in which the average luminance is higher than a predetermined lower limit value and lower than a predetermined upper limit value as the region of interest.
 9. The image processing apparatus as defined in claim 5, wherein the characteristic amount calculation unit uses the number of pixels constituting edges normalized by a pixel count of each region.
 10. The image processing apparatus as defined in claim 2, wherein the region division unit divides the image into a central region positioned in a center of the image and one or more peripheral regions positioned on a periphery of the central region.
 11. The image processing apparatus as defined in claim 1, wherein the contribution calculation unit sets the contribution of the motion vector of the motion vector measurement region not included in the region of interest at zero.
 12. The image processing apparatus as defined in claim 1, further comprising a motion vector reliability calculation unit that calculates a reliability value indicating a reliability of the motion vector calculated in each of the plurality of motion vector measurement regions, wherein the motion vector integration unit determines the inter-image motion vector by integrating the motion vectors calculated respectively in the plurality of motion vector measurement regions in accordance with the calculated contribution and the calculated reliability value.
 13. An electronic device having the image processing apparatus as defined in claim
 1. 14. A storage medium storing an image processing program for causing a computer to execute registration processing between a plurality of images through a motion vector calculation, the image processing program comprising the steps of: setting a plurality of motion vector measurement regions for determining motion vectors on an image; calculating a motion vector in each of the plurality of motion vector measurement regions; specifying a region of interest by user interest on the image; determining whether or not each of the plurality of motion vector measurement regions is included in the region of interest; calculating a contribution of each motion vector such that the contribution of the motion vector of a motion vector measurement region included in the region of interest is larger than the contribution of the motion vector of a motion vector measurement region not included in the region of interest; and determining an inter-image motion vector by integrating the motion vectors calculated respectively in the plurality of motion vector measurement regions in accordance with the calculated contribution.
 15. An image processing method for performing image registration processing between a plurality of images through a motion vector calculation, comprising the steps of: setting a plurality of motion vector measurement regions for determining motion vectors on an image; calculating a motion vector in each of the plurality of motion vector measurement regions; specifying a region of interest by user interest on the image; determining whether or not each of the plurality of motion vector measurement regions is included in the region of interest; calculating a contribution of each motion vector such that the contribution of the motion vector of a motion vector measurement region included in the region of interest is larger than the contribution of the motion vector of a motion vector measurement region not included in the region of interest; and determining an inter-image motion vector by integrating the motion vectors calculated respectively in the plurality of motion vector measurement regions in accordance with the calculated contribution. 